/**
  ******************************************************************************
  * @file    log.h
  * @author  Application Team
    * @Version V1.0.0
  * @Date    1-April-2019
  * @brief   Header file of log module.
  ******************************************************************************
  */



#ifndef __CX32L003_LOG_H
#define __CX32L003_LOG_H

/* Includes ------------------------------------------------------------------*/
#include "io_mapping.h"
#include "stdbool.h"
#include "uart.h"

/* Exported constants ---------------------------------------------------------*/



/* Exported macros-------------------------------------------------------------*/

/* Choose one from below */
#define    LOG_METHOD_SERIAL
//#define    LOG_METHOD_RAM

#ifdef LOG_METHOD_RAM
    /* Choose a valid address without any confliction */
    #define    LOG_RAM_ADDRESS        0x20001000
    #define LOG_RAM_CHAR        ((volatile char *)(LOG_RAM_ADDRESS))
#endif

//#define DEBUG

#ifdef  DEBUG
#define DbgPrintf(format, ...)  printf (format, ##__VA_ARGS__)
//#define DbgPrintf(format,...) printf("File: "__FILE__", Line: %05d: "format"\n", __LINE__, ##__VA_ARGS__)  
#else  
#define DbgPrintf(format,...)  
#endif  


void logout(bool success);

void panic(const char* func);

#endif /* __XM32F103_LOG_H */
